package co.edu.unal.bioingenium.kbmed.retrieval.data;

import co.edu.unal.bioingenium.kbmed.retrieval.vo.QueryDocument;
import co.edu.unal.bioingenium.kbmed.retrieval.vo.RelevantDocument;
import gnu.trove.map.TObjectFloatMap;
import gnu.trove.map.hash.TObjectFloatHashMap;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 *
 * @author alejandro
 */
public class RetrievalData implements Serializable {

    private QueryDocument queryDocument;
    private Set<String> candidateDescriptorSet;
    private Set<String> expandedDescriptorSet;
    private Set<String> resultsDescriptorSet;
    private Set<String> surgeryDescriptorSet;
    private Set<Integer> candidateDocumentsSet;
    private List<RelevantDocument> results;
    private TObjectFloatMap<String> candidateDescriptorScore;
    private TObjectFloatMap<String> expandedDescriptorScore;
    private TObjectFloatMap<String> resultsDescriptorScore;
    private TObjectFloatMap<String> surgeryDescriptorScore;

    /**
     *
     */
    public RetrievalData() {
        candidateDescriptorSet = new HashSet<String>();
        candidateDocumentsSet = new HashSet<Integer>();
        expandedDescriptorSet = new HashSet<String>();
        resultsDescriptorSet = new HashSet<String>();
        surgeryDescriptorSet = new HashSet<String>();
        results = new ArrayList<RelevantDocument>();
        candidateDescriptorScore = new TObjectFloatHashMap<String>();
        expandedDescriptorScore = new TObjectFloatHashMap<String>();
        resultsDescriptorScore = new TObjectFloatHashMap<String>();
        surgeryDescriptorScore = new TObjectFloatHashMap<String>();
    }

    /**
     *
     * @return
     */
    public boolean hasPreviusData() {
        if (!candidateDescriptorSet.isEmpty() || !candidateDocumentsSet.isEmpty() || !expandedDescriptorSet.isEmpty() || !results.isEmpty()) {
            return true;
        }
        if (queryDocument != null && !queryDocument.getQueryString().equalsIgnoreCase("")) {
            return true;
        }
        return false;
    }

    /**
     *
     */
    public void clearPreviusData() {
        queryDocument.clearPrevisuData();
        candidateDescriptorSet.clear();
        candidateDocumentsSet.clear();
        expandedDescriptorSet.clear();
        results.clear();
    }

    /**
     *
     * @return
     */
    public QueryDocument getQueryDocument() {
        return queryDocument;
    }

    /**
     *
     * @param queryDocument
     */
    public void setQueryDocument(QueryDocument queryDocument) {
        this.queryDocument = queryDocument;
    }

    /**
     *
     * @return
     */
    public Set<String> getCandidateDescriptorSet() {
        return candidateDescriptorSet;
    }

    /**
     *
     * @param candidateDescriptorSet
     */
    public void setCandidateDescriptorSet(Set<String> candidateDescriptorSet) {
        this.candidateDescriptorSet = candidateDescriptorSet;
    }

    /**
     *
     * @return
     */
    public Set<Integer> getCandidateDocumentsSet() {
        return candidateDocumentsSet;
    }

    /**
     *
     * @param candidateDocumentsSet
     */
    public void setCandidateDocumentsSet(Set<Integer> candidateDocumentsSet) {
        this.candidateDocumentsSet = candidateDocumentsSet;
    }

    /**
     *
     * @return
     */
    public List<RelevantDocument> getResults() {
        return results;
    }

    /**
     *
     * @param results
     */
    public void setResults(List<RelevantDocument> results) {
        this.results = results;
    }

    /**
     *
     * @return
     */
    public Set<String> getExpandedDescriptorSet() {
        return expandedDescriptorSet;
    }

    /**
     *
     * @param expandedDescriptorSet
     */
    public void setExpandedDescriptorSet(Set<String> expandedDescriptorSet) {
        this.expandedDescriptorSet = expandedDescriptorSet;
    }

    /**
     *
     * @return
     */
    public TObjectFloatMap<String> getCandidateDescriptorScore() {
        return candidateDescriptorScore;
    }

    /**
     *
     * @param candidateDescriptorScore
     */
    public void setCandidateDescriptorScore(TObjectFloatMap<String> candidateDescriptorScore) {
        this.candidateDescriptorScore = candidateDescriptorScore;
    }

    /**
     *
     * @return
     */
    public TObjectFloatMap<String> getExpandedDescriptorScore() {
        return expandedDescriptorScore;
    }

    /**
     *
     * @param expandedDescriptorScore
     */
    public void setExpandedDescriptorScore(TObjectFloatMap<String> expandedDescriptorScore) {
        this.expandedDescriptorScore = expandedDescriptorScore;
    }

    /**
     *
     * @return
     */
    public TObjectFloatMap<String> getResultsDescriptorScore() {
        return resultsDescriptorScore;
    }

    /**
     *
     * @param resultsDescriptorScore
     */
    public void setResultsDescriptorScore(TObjectFloatMap<String> resultsDescriptorScore) {
        this.resultsDescriptorScore = resultsDescriptorScore;
    }

    /**
     *
     * @return
     */
    public Set<String> getResultsDescriptorSet() {
        return resultsDescriptorSet;
    }

    /**
     *
     * @param resultsDescriptorSet
     */
    public void setResultsDescriptorSet(Set<String> resultsDescriptorSet) {
        this.resultsDescriptorSet = resultsDescriptorSet;
    }

    /**
     * 
     * @return
     */
    public TObjectFloatMap<String> getSurgeryDescriptorScore() {
        return surgeryDescriptorScore;
    }

    /**
     * 
     * @param surgeryDescriptorScore
     */
    public void setSurgeryDescriptorScore(TObjectFloatMap<String> surgeryDescriptorScore) {
        this.surgeryDescriptorScore = surgeryDescriptorScore;
    }

    /**
     * 
     * @return
     */
    public Set<String> getSurgeryDescriptorSet() {
        return surgeryDescriptorSet;
    }

    /**
     * 
     * @param surgeryDescriptorSet
     */
    public void setSurgeryDescriptorSet(Set<String> surgeryDescriptorSet) {
        this.surgeryDescriptorSet = surgeryDescriptorSet;
    }
}
